Telegram Group & Telegram Channel
Python позволяет узнать путь к любому исходному файлу. Внутри файла переменная __file__ возвращает относительный путь к нему:


$ cat test/foo.py
print(__file__)
$ python test/foo.py
test/foo.py


Типичное применение этого — определить путь, где находится сам скрипт. Это может быть полезно, например, для поиска других файлов: конфигураций, ресурсов и т.д.

Чтобы получить абсолютный путь из относительного, можно использовать os.path.abspath. Поэтому распространённый приём для получения пути к директории скрипта выглядит так:


import os

dir_path = os.path.dirname(
os.path.abspath(__file__)
)


👉@BookPython



tg-me.com/BookPython/3647
Create:
Last Update:

Python позволяет узнать путь к любому исходному файлу. Внутри файла переменная __file__ возвращает относительный путь к нему:


$ cat test/foo.py
print(__file__)
$ python test/foo.py
test/foo.py


Типичное применение этого — определить путь, где находится сам скрипт. Это может быть полезно, например, для поиска других файлов: конфигураций, ресурсов и т.д.

Чтобы получить абсолютный путь из относительного, можно использовать os.path.abspath. Поэтому распространённый приём для получения пути к директории скрипта выглядит так:


import os

dir_path = os.path.dirname(
os.path.abspath(__file__)
)


👉@BookPython

BY Библиотека Python разработчика | Книги по питону


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/BookPython/3647

View MORE
Open in Telegram


Библиотека Python разработчика | Книги по питону Telegram | DID YOU KNOW?

Date: |

What is Secret Chats of Telegram

Secret Chats are one of the service’s additional security features; it allows messages to be sent with client-to-client encryption. This setup means that, unlike regular messages, these secret messages can only be accessed from the device’s that initiated and accepted the chat. Additionally, Telegram notes that secret chats leave no trace on the company’s services and offer a self-destruct timer.

That strategy is the acquisition of a value-priced company by a growth company. Using the growth company's higher-priced stock for the acquisition can produce outsized revenue and earnings growth. Even better is the use of cash, particularly in a growth period when financial aggressiveness is accepted and even positively viewed.he key public rationale behind this strategy is synergy - the 1+1=3 view. In many cases, synergy does occur and is valuable. However, in other cases, particularly as the strategy gains popularity, it doesn't. Joining two different organizations, workforces and cultures is a challenge. Simply putting two separate organizations together necessarily creates disruptions and conflicts that can undermine both operations.

Библиотека Python разработчика | Книги по питону from jp


Telegram Библиотека Python разработчика | Книги по питону
FROM USA